<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // includs()检测 数组里是否有某个值，如果没有就放到新数组里

      var arr = [1, 1, "true", "true", true, true, 15, 15, false, false, undefined, undefined, null, null, NaN, NaN, "NaN", 0, 0, "a", "a", {}, {}];

      var newArr = [];
      for (var i = 0; i < arr.length; i++) {
        if (!newArr.includes(arr[i])) {
          newArr.push(arr[i]);
        }
      }
      console.log(newArr);
      // 0: 1
      // 1: "true"
      // 2: true
      // 3: 15
      // 4: false
      // 5: undefined
      // 6: null
      // 7: NaN
      // 8: "NaN"
      // 9: 0
      // 10: "a"
      // 11: {}
      // 12: {}
   
   //可以 去重 NaN 但不能去重 {}

    </script>
  </body>
</html>
